LAGOS Analysis

Loading in data

First download and then specifically grab the locus (or site lat longs)

# #Lagos download script
# lagosne_get(version='1.087.1',dest_folder = LAGOSNE:::lagos_path())

#run this before Th
lagosne_get(dest_folder = LAGOSNE:::lagos_path())
## Warning in lagosne_get(dest_folder = LAGOSNE:::lagos_path()): LAGOSNE data for this version already exists on the local machine.
##   Re-download if neccessary using the 'overwrite` argument.'
# #Load in lagos
# lagos <- lagosne_load()
# 
# #Grab the lake centroid info
# lake_centers <- lagos$locus

load('lake_centers.Rdata')

Convert to spatial data

#Look at the column names
#names(lake_centers)

#Look at the structure
#str(lake_centers)

#View the full dataset
#View(lake_centers %>% slice(1:100))

spatial_lakes <- st_as_sf(lake_centers,coords=c('nhd_long','nhd_lat'),
                          crs=4326) %>%
  st_transform(2163)

#Subset for plotting
subset_spatial <- spatial_lakes %>%
  slice(1:100)

#Dynamic mapviewer
mapview(subset_spatial)

Subset to only Minnesota

states <- us_states()

#Plot all the states to check if they loaded
#mapview(states)
minnesota <- states %>%
  filter(name == 'Minnesota') %>%
  st_transform(2163)

#Subset lakes based on spatial position
minnesota_lakes <- spatial_lakes[minnesota,]

#Plotting the first 1000 lakes
minnesota_lakes %>%
  slice(1:1000) %>%
  arrange(lake_area_ha) %>%
  mapview(.,zcol = 'lake_area_ha')

In-Class work

1) Show a map outline of Iowa and Illinois (similar to Minnesota map upstream)

2) Subset LAGOS data to these sites, how many sites are in Illinois and Iowa

combined? How does this compare to Minnesota?

Illinois and Iowa have 16,466 sites. Minnesota has 29,038 sites.

## Classes 'sf' and 'data.frame':   16466 obs. of  17 variables:
##  $ lagoslakeid      : int  4280 4285 4292 4312 4314 4322 4351 4363 4389 4393 ...
##  $ nhdid            : Factor w/ 141265 levels "{001938B4-A003-4A71-9045-3733BA813E8A}",..: 76762 45677 39985 52251 67085 71036 41627 45724 76807 67162 ...
##  $ gnis_name        : Factor w/ 20878 levels "0.2 Reservoir",..: 4977 623 NA NA 16087 NA 8989 16598 NA 1067 ...
##  $ lake_area_ha     : num  8.59 17.27 3.97 10.68 208.45 ...
##  $ lake_perim_meters: num  2747 4146 1603 2323 18841 ...
##  $ nhd_fcode        : int  39004 39004 39004 39004 39004 39004 39004 39009 39004 39004 ...
##  $ nhd_ftype        : int  390 390 390 390 390 390 390 390 390 390 ...
##  $ iws_zoneid       : Factor w/ 51065 levels "IWS_1","IWS_10",..: 24354 24739 NA 26413 21316 21461 27047 45565 21450 24287 ...
##  $ hu4_zoneid       : Factor w/ 66 levels "HU4_1","HU4_10",..: 50 49 55 49 50 50 49 49 50 50 ...
##  $ hu6_zoneid       : Factor w/ 92 levels "HU6_1","HU6_10",..: 73 74 83 74 78 73 74 74 73 73 ...
##  $ hu8_zoneid       : Factor w/ 511 levels "HU8_10","HU8_100",..: 332 335 352 338 325 333 337 335 332 327 ...
##  $ hu12_zoneid      : Factor w/ 16482 levels "HU12_10","HU12_100",..: 16326 10816 10321 11040 10527 10767 10926 10834 10748 16269 ...
##  $ edu_zoneid       : Factor w/ 92 levels "EDU_1","EDU_10",..: 16 72 34 58 58 16 58 72 16 16 ...
##  $ county_zoneid    : Factor w/ 953 levels "County_1","County_10",..: 166 118 121 170 167 219 225 192 196 141 ...
##  $ state_zoneid     : Factor w/ 18 levels "OUT_OF_COUNTY_STATE",..: 6 6 6 6 6 6 6 6 6 6 ...
##  $ elevation_m      : num  372 328 340 287 266 ...
##  $ geometry         :sfc_POINT of length 16466; first list element:  'XY' num  523429 -208312
##  - attr(*, "sf_column")= chr "geometry"
##  - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA NA NA NA NA NA NA ...
##   ..- attr(*, "names")= chr  "lagoslakeid" "nhdid" "gnis_name" "lake_area_ha" ...
## Classes 'sf' and 'data.frame':   29038 obs. of  17 variables:
##  $ lagoslakeid      : int  59 60 61 62 63 64 67 68 71 72 ...
##  $ nhdid            : Factor w/ 141265 levels "{001938B4-A003-4A71-9045-3733BA813E8A}",..: 141203 127361 131969 19869 125106 86424 20825 131427 39818 137132 ...
##  $ gnis_name        : Factor w/ 20878 levels "0.2 Reservoir",..: 10485 NA 11399 9309 540 3227 7866 13350 9074 20581 ...
##  $ lake_area_ha     : num  27.21 6.68 75.23 914.97 75.68 ...
##  $ lake_perim_meters: num  3956 2063 7011 18872 6643 ...
##  $ nhd_fcode        : int  39004 39004 39004 39004 39004 39004 39004 39004 39004 39004 ...
##  $ nhd_ftype        : int  390 390 390 390 390 390 390 390 390 390 ...
##  $ iws_zoneid       : Factor w/ 51065 levels "IWS_1","IWS_10",..: 20999 19530 2471 17584 30262 21196 13442 19826 30824 18038 ...
##  $ hu4_zoneid       : Factor w/ 66 levels "HU4_1","HU4_10",..: 48 19 18 46 16 48 15 19 55 46 ...
##  $ hu6_zoneid       : Factor w/ 92 levels "HU6_1","HU6_10",..: 72 32 25 70 27 72 68 32 83 70 ...
##  $ hu8_zoneid       : Factor w/ 511 levels "HU8_10","HU8_100",..: 254 274 41 271 34 284 265 43 352 273 ...
##  $ hu12_zoneid      : Factor w/ 16482 levels "HU12_10","HU12_100",..: 64 1048 4262 280 4114 80 862 1078 16002 9201 ...
##  $ edu_zoneid       : Factor w/ 92 levels "EDU_1","EDU_10",..: 5 65 66 75 51 5 38 65 34 36 ...
##  $ county_zoneid    : Factor w/ 953 levels "County_1","County_10",..: 411 355 386 437 373 447 392 435 431 400 ...
##  $ state_zoneid     : Factor w/ 18 levels "OUT_OF_COUNTY_STATE",..: 7 7 7 7 7 7 7 7 7 7 ...
##  $ elevation_m      : num  206 306 468 329 469 ...
##  $ geometry         :sfc_POINT of length 29038; first list element:  'XY' num  579194 -15118
##  - attr(*, "sf_column")= chr "geometry"
##  - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA NA NA NA NA NA NA ...
##   ..- attr(*, "names")= chr  "lagoslakeid" "nhdid" "gnis_name" "lake_area_ha" ...

3) What is the distribution of lake size in Iowa vs. Minnesota?

  • Here I want to see a histogram plot with lake size on x-axis and frequency on y axis (check out geom_histogram)

4) Make an interactive plot of lakes in Iowa and Illinois and color them

by lake area in hectares

5) What other data sources might we use to understand how reservoirs and

natural lakes vary in size in these three states?

Other sources of data that we might use to explore the difference in lakes

and reservoirs in the three starts are